package org.apache.jsp.totalSearch;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.util.*;

public final class UnitSearch_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();

  private static java.util.List _jspx_dependants;

  private javax.el.ExpressionFactory _el_expressionfactory;
  private org.apache.AnnotationProcessor _jsp_annotationprocessor;

  public Object getDependants() {
    return _jspx_dependants;
  }

  public void _jspInit() {
    _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
    _jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
  }

  public void _jspDestroy() {
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      response.setContentType("text/html; charset=EUC-KR");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      java.util.Hashtable outputTable = null;
      synchronized (request) {
        outputTable = (java.util.Hashtable) _jspx_page_context.getAttribute("outputTable", PageContext.REQUEST_SCOPE);
        if (outputTable == null){
          outputTable = new java.util.Hashtable();
          _jspx_page_context.setAttribute("outputTable", outputTable, PageContext.REQUEST_SCOPE);
        }
      }
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");

	ArrayList searchInfoList = (ArrayList)outputTable.get("searchInfoList");
	String type = (String)outputTable.get("type");
	String word = (String)outputTable.get("word");
	
	String koType = "";
	
	if(type.equals("price")) koType = "가격";
	if(type.equals("title")) koType = "상품명";
	
	System.out.println(word);


      out.write("\r\n");
      out.write("\t\t<TABLE>\t\r\n");
      out.write("\t\t\t<tr> \r\n");
      out.write("\t\t\t\t<td  height=\"30\" bgcolor='f7f7f7' style='padding:0 0 0 15'><img src='image/sub/search_code.gif' align='absmiddle'> &nbsp;&nbsp;&nbsp;현재 ‘");
      out.print(koType );
      out.write(" : <FONT  COLOR=\"#e10000\"><b>");
      out.print(word );
      out.write("</b></FONT> '(으)로 검색하셨습니다.</td> \r\n");
      out.write("\t\t\t</tr>\r\n");
      out.write("\t\t</TABLE>\t\r\n");
      out.write("\t\t\r\n");
      out.write("\t\t<!-- 목록상에서 상품 1개의 상세정보 출력 include 파일 (바둑판식) --> \r\n");
      out.write("\t\t\r\n");
      out.write("\t\t<TABLE style=\"table-layout:fixed;\" width=\"134\" border=\"0\" cellspacing=\"2\" cellpadding=\"0\" align=\"center\">\r\n");
      out.write("\t\r\n");
 
		int loopNum = searchInfoList.size(); 
	
		if(searchInfoList.size()%5 != 0)
		{
			loopNum = loopNum + 1;
		}
		
		for(int i=0; i<loopNum; i++)
		{		

      out.write("\r\n");
      out.write("\t\t\t<TR>\r\n");

			for(int j=0; j<5; j++)
			{
				int getNum = (i * 5) + j;
				if(getNum < searchInfoList.size())
				{
					Hashtable productInfo = (Hashtable)searchInfoList.get(getNum);
					
					String name = (String)productInfo.get("NAME");
					String price = (String)productInfo.get("PRICE");
					String info = (String)productInfo.get("INFO");
					String imgPath = (String)productInfo.get("PATH");
					
					if(info.length()>15) info = info.substring(0, 15)+"...";
					

      out.write("\t\t\t\t\r\n");
      out.write("\t\t\t\t\t<TD width=\"150\">\r\n");
      out.write("\t\t\t\t\t\t<table style=\"table-layout:fixed;\" width=\"134\" border=\"0\" cellspacing=\"2\" cellpadding=\"0\" align=\"center\">\r\n");
      out.write("\t\t\t\t\t\t<!-- 목록상에서 상품 1개의 상세정보 출력 include 파일 (바둑판식) --> \r\n");
      out.write("\t\t\t\t\t\t\t<tr> \r\n");
      out.write("\t\t\t\t\t\t\t\t<td valign=\"top\" align=\"center\"><a href=\"\"><img style=\"border-width:1px;border-color:#cccccc;border-style:solid;\" src=\"");
      out.print(imgPath );
      out.write("\" width=\"100\" height=\"100\" border=\"0\"></a></td> \r\n");
      out.write("\t\t\t\t\t\t\t</tr> \r\n");
      out.write("\t\t\t\t\t\t\t<tr> \r\n");
      out.write("\t\t\t\t\t\t\t\t<td><div align=\"center\"><br><a href=\"\"><font color=\"#262626\">");
      out.print(name );
      out.write("</font></a></div></td> \r\n");
      out.write("\t\t\t\t\t\t\t</tr>\t\r\n");
      out.write("\t\t\t\t\t\t\t<tr> \r\n");
      out.write("\t\t\t\t\t\t\t\t<td align=\"center\"><font color=\"#808080\">");
      out.print(info );
      out.write("</font></td> \r\n");
      out.write("\t\t\t\t\t\t\t</tr>\t\t\r\n");
      out.write("\t\t\t\t\t\t\t<tr> \r\n");
      out.write("\t\t\t\t\t\t\t\t<td> \r\n");
      out.write("\t\t\t\t\t\t\t\t\t<table align=\"center\">\t\t\t\t\r\n");
      out.write("\t\t\t\t\t\t\t\t\t\t<tr>\r\n");
      out.write("\t\t\t\t\t\t\t\t\t\t\t<td><img src=\"/images/goods_price_img.gif\"></td> \r\n");
      out.write("\t\t\t\t\t\t\t\t\t\t\t<td><font color=\"#AB186A\"><b>");
      out.print(price );
      out.write("</b></font></td>\t\t\t\t\r\n");
      out.write("\t\t\t\t\t\t\t\t\t\t</tr>\t\t\t\r\n");
      out.write("\t\t\t\t\t\t\t\t\t</table> \r\n");
      out.write("\t\t\t\t\t\t\t\t</td> \r\n");
      out.write("\t\t\t\t\t\t\t</tr>\t\t\t\r\n");
      out.write("\t\t\t\t\t\t\t<tr> \r\n");
      out.write("\t\t\t\t\t\t\t\t<td align=center><a href=\"\"><img src=\"/images/goods_view.gif\"></a></td>\r\n");
      out.write("\t\t\t\t\t\t\t</tr>\t\r\n");
      out.write("\t\t\t\t\t\t\t<tr> \r\n");
      out.write("\t\t\t\t\t\t\t\t<td align=\"center\"><a href=\"\"><img src=\"/images/goods_purchase.gif\" border=\"0\"></a></td> \r\n");
      out.write("\t\t\t\t\t\t\t</tr>\t\t\t\r\n");
      out.write("\t\t\t\t\t\t\t</table> \r\n");
									
				}
				else
				{

      out.write("\r\n");
      out.write("\t\t\t\t\t<TD width=\"115\"></TD>\r\n");

				}
			}

      out.write("\r\n");
      out.write("\t\t\t</TR>\r\n");

		}

      out.write("\r\n");
      out.write("\t\t</TABLE>\r\n");
      out.write("\r\n");
      out.write("\r\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try { out.clearBuffer(); } catch (java.io.IOException e) {}
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}
